﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core.DataAccess.IRepositories;
using System.ComponentModel.Composition;

namespace Core.DataAccess.Repositories
{
    [Export(typeof(IFileFolderRepository))]
    public class FileFolderRepository : IFileFolderRepository
    {
        private Connection conn;

        public FileFolderRepository()
        {
            conn = new Connection();
        }

        public void SaveFileFolder(List<long> files, Guid folderID, int accountID)
        {
            using (MXHEntities context = conn.GetContext())
            {
                files.ForEach(n => context.FolderFiles.AddObject(new FolderFile { FolderID = folderID, AccountID = accountID, FileID = n, CreateDate = DateTime.Now }));
                context.SaveChanges();
            }                
        }
    }
}
